/*
 * Copyright 2020-2020 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.sagacity.framework.api.constant;

/**
 * 响应码枚举
 * @author xingyun
 * @date 2020-07-04 14:17
 */
public enum ResponseCode implements IResponseCode {
    SUCCESS("2000","success"),
    ARGUMENT_EMPTY("4000","参数为空"),
    ARGUMENT_ILLEGAL("4001","参数非法"),
    /**
     * 自己知道的异常，编码可使用此
     */
    FAIL("5000","请求失败"),
    /**
     * 不可预知异常（大段捕获后抛出异常，则编码ERROR）
     */
    ERROR("6000","程序异常"),

    HYSTRIX("6001","服务火爆，稍后重试"),
    ;

    private final String code;
    private final String msg;

    ResponseCode(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
